Skip to content

ramdisk: headless planning, staging, mounts, recovery + tokenized CLI (PR2 of #377 split) - #821

Draft
BColsey wants to merge 3 commits into
JustVugg:devfrom
BColsey:successor/pr2-headless
Draft

ramdisk: headless planning, staging, mounts, recovery + tokenized CLI (PR2 of #377 split)#821
BColsey wants to merge 3 commits into
JustVugg:devfrom
BColsey:successor/pr2-headless

Conversation

@BColsey

@BColsey BColsey commented Aug 4, 2026

Copy link
Copy Markdown

Draft successor — supersedes #377. One of three dependent PRs reconstructed from the frozen green donor 5f6f31a. Do not merge #377.

Scope

Headless planning/discovery, platform ops, durable state, safe mount recovery, the reduced facade + tokenized CLI, packaging, and portable tests. No frontend/TUI; managed start/stop deferred to PR3.

Control plane: c/ramdisk.py, c/__init__.py, c/ramdisk_support/{__init__,accelerator,cli,common,discovery,lifecycle,linux_ops,model,mounts,planning,platform_ops,presentation,presets,processes,state}.py. Packaging: c/coli, c/tools/clean.py, pyproject.toml, flake.nix. Portable tests (state_lifecycle, processes, mounts, planning, platform, packaging, CLI/JSON smoke, facade, …) + docs/CI.

Reconstruction work (drafts may not build in isolation until these land)

  • Tokenized JSON CLI (design L56-73): plan / stage --plan-token / read-only verify / status / destroy --deployment-token, all --json; versioned result/error schemas. prepare stays an alias; managed start/stop stay deferred to PR3.
  • Sever the eager UI import: presentation.py imports ramdisk_ui at module top level — relocate the data contracts + token builders into a headless ramdisk_support module so PR2 builds with ramdisk_ui/ramdisk_textual/curses_ui physically absent.
  • Packaging: drop textual as a hard pyproject.toml dep (→ tui extra); stop c/coli and flake.nix from requiring/bundling UI files; update test_ramdisk_packaging.py bundle assertions.

Dependency

Depends on PR1 (#820): c/coli imports resource_plan.py (PR1). PR3 (#822) depends on this PR's durable state + recovery.

Build verification (subagent worktree)

  • Package imports; lifecycle/state/processes import cleanly. 233 passed / 36 failed — every failure traces to the intentionally-excluded UI/benchmark/curses bundle (no unexpected defect).
  • Sharper blocker found by execution: it is not only presentation.py:10 importing ramdisk_ui — the coli launcher top-level bundle self-check (_complete_support, c/coli:67-162) hard-aborts with SystemExit("coli: incomplete colocated support bundle …") when ramdisk_ui.py/ramdisk_textual.py/benchmark.py/curses_ui.py/runtime_monitor.py are absent, killing the unittest runner. PR2 must make that self-check absence-tolerant (and have the lazy importlib accessors treat a missing optional module as "feature unavailable", not a hard abort).

Reconstruction update

PR2 reconstruction landed (commit b7a6df4): builds and tests UI-free. Absence-tolerant coli bundle self-check (no SystemExit); new headless ramdisk_support/contracts.py (contracts relocated out of the excluded ramdisk_ui); presentation.py imports from .contracts; textual moved to an optional tui extra; lazy accessors raise only on use. Green: 705 passed / 0 failed (3.10 + Win32 matrix). Still TODO: tokenized JSON CLI (stage/verify/destroy).

BColsey and others added 2 commits August 3, 2026 22:07
Co-Authored-By: Claude <noreply@anthropic.com>
…d CLI from donor 5f6f31a

Co-Authored-By: Claude <noreply@anthropic.com>
…dless contracts, textual extra)

PR2 excludes the UI/benchmark/curses/monitor modules but still required
them, so the launcher aborted (SystemExit) and presentation.py failed to
import. Reconstruct the headless control plane so it builds and tests green
with those modules physically absent.

- coli _complete_support: split REQUIRED vs OPTIONAL bundle members
  (ramdisk_ui/ramdisk_textual/benchmark/curses_ui/runtime_monitor). A
  missing OPTIONAL member now warns, never aborts; only the core headless
  modules remain required. contracts.py is a new required headless member.
- ramdisk_support/contracts.py (new): headless home for the data contracts
  previously imported from the excluded ramdisk_ui (PlacementContract,
  ActionPolicy, DeploymentHealth, HealthLevel, ReviewIdentity, plus
  ActionPermission/ReviewAction). presentation.py imports from .contracts
  and no longer touches any UI module.
- ramdisk.py: optional lazy accessors (_benchmark/_curses/_textual_module)
  raise a clear RamdiskError only when the feature is actually used, not at
  import/collection time. __all__/__dir__ exclude optional exports when the
  backing module is absent so 'from ramdisk import *' stays clean headless.
- Relocate two pure core utilities that were trapped in optional bundles:
  _normalized_runtime_knobs (needed by lifecycle.start) and
  _TuiTerminationSignal (a signal carrier used by mount/state tests) into
  ramdisk_support/common.py so the core path is headless.
- pyproject.toml: move textual from a hard dependency to an optional 'tui'
  extra; keep requires-python>=3.10 and setuptools>=77.0.1. Restore
  requirements-tui.txt as the tui extra pin file.
- Tests adapted to the headless reality: packaging fixtures copy/assert the
  headless bundle; optional-feature tests skip when their module is absent;
  JSON-pipeline tests tolerate the benign headless launcher notice; the
  platform skip inventory drops references to absent test modules.

Verified: cd c && python3.10 -m unittest discover -s tests -p test_*.py
-> Ran 725 tests, OK (skipped=20). COLIBRI_TEST_TARGET_PLATFORM=win32
-> Ran 725 tests, OK (skipped=58), no NameError.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant